package com.assessment.servermanager.controller;

import javax.servlet.http.HttpServletResponse;

import com.assessment.servermanager.commen.controller.BaseController;
import com.assessment.servermanager.commen.entity.AjaxResult;
import com.assessment.servermanager.commen.page.TableDataInfo;
import com.assessment.servermanager.entity.TbSalary;
import com.assessment.servermanager.service.ITbSalaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
 * 【请填写功能名称】Controller
 * 
 * @author jiajia
 * @date 2023-08-28
 */
@RestController
@RequestMapping("/salary")
public class TbSalaryController extends BaseController
{
    @Autowired
    private ITbSalaryService tbSalaryService;

    /**
     * 查询【请填写功能名称】列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TbSalary tbSalary)
    {

        List<TbSalary> list = tbSalaryService.selectTbSalaryList(tbSalary);
        return getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbSalary tbSalary)
    {
        /*List<TbSalary> list = tbSalaryService.selectTbSalaryList(tbSalary);
        ExcelUtil<TbSalary> util = new ExcelUtil<TbSalary>(TbSalary.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");*/
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tbSalaryService.selectTbSalaryById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PostMapping
    public AjaxResult add(@RequestBody TbSalary tbSalary)
    {
        return toAjax(tbSalaryService.insertTbSalary(tbSalary));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PutMapping
    public AjaxResult edit(@RequestBody TbSalary tbSalary)
    {
        return toAjax(tbSalaryService.updateTbSalary(tbSalary));
    }

    /**
     * 删除【请填写功能名称】
     */
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tbSalaryService.deleteTbSalaryByIds(ids));
    }
}
